<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@attribute name="courses" required="true" type="java.util.List" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<fmt:setLocale value="${language}"/>
<fmt:bundle basename="messages" prefix="courselist.">
    <div class="table-responsive">
        <table class="table table-striped">
            <thead>
            <tr>
                <th><fmt:message key="name"/></th>
                <th><fmt:message key="descr"/></th>
                <th><fmt:message key="price"/></th>
                <th><fmt:message key="mentor"/></th>
                <th></th>
                <th></th>
                <th></th>
            </tr>
            </thead>
            <tbody>
            <c:forEach items="${courses}" var="course">
                <tr>
                    <td>${course.courseName}</td>
                    <td>${course.courseDescription}</td>
                    <td>${course.courseMonthlyPrice}</td>
                    <td>${course.mentor.name} ${course.mentor.surname}</td>
                    <td>
                        <form action="/maa/do" method="post"><input type="hidden" name="action"
                                                                    value="course-update-page"/>
                            <input type="hidden" name="uuid" value=${course.uuid}/>
                            <input class="btn btn-default mybtn" type="submit" value="<fmt:message key="update"/>"/></form>
                    </td>
                    <td>
                        <form action="/maa/do" method="post"><input type="hidden" name="action" value="remove-course"/>
                            <input type="hidden" name="uuid" value=${course.uuid}/>
                            <input class="btn btn-default mybtn" type="submit" value="<fmt:message key="remove"/>"/></form>
                    </td>
                    <td>
                        <form action="/maa/do" method="post"><input type="hidden" name="action" value="choose-mentor"/>
                            <input type="hidden" name="course-uuid" value=${course.uuid}/>
                            <input class="btn btn-default mybtn" type="submit" value="<fmt:message key="choosementor"/>"/></form>
                    </td>
                </tr>
            </c:forEach>
            </tbody>
        </table>
    </div>
</fmt:bundle>
<%--<td><a href = "maa/do?action=remove_course&id=${entity.uuid}">Delete course</a></td>--%>